#include "MainScene.h"
//#include "messenger/layer/MessengerTreeLayer.h"
//#include "messenger/layer/MessengerAnimalLayer.h"
//#include "goldMining/layer/GoldMiningSquareLayer.h"
//#include "goldMining/layer/GoldMiningMountainLayer.h"
//#include "goldMining/layer/GoldMiningPlaceLayer.h"
//#include "goldMining/layer/GoldMiningTreeLayer.h"
//#include "goldMining/layer/GoldMiningHideAndFindFirstLayer.h"
//#include "goldMining/layer/GoldMiningHideAndFindSecondLayer.h"
//#include "mushroom/layer/HitMonsterLayer.h"
//#include "peripheral/layer/BubbleLayer.h"
//#include "peripheral/layer/BubbleWaittingLayer.h"
//#include "peripheral/layer/AwardLayer.h"
//#include "layer/WonderlandLayer.h"
//#include "TLG/layer/TLGTreeLayer.h"
//#include "mushroom/layer/NewMushroomLayer.h"
//#include "forest/layer/NewForestLayer.h"
bool MainScene::init()
{
	if (!Scene::init())
	{
		return false;
	}

	return true;
}

void MainScene::setDisplay(const char* csbFileName)
{
	//TODO choose different layer
	/*if (0 == strcmp(csbFileName, "scene/MushroomScene.csb"))
	{
		auto mushroomLayer = MushroomLayer::create();
		mushroomLayer->setDisplay(csbFileName);
		this->addChild(mushroomLayer);
	}
	else if (0 == strcmp(csbFileName, "scene/HomeScene.csb"))
	{
		auto treeLayer = ForestTreeLayer::create();
		treeLayer->setDisplay(csbFileName);
		this->addChild(treeLayer);
	}
	else if ((0 == strcmp(csbFileName, "scene/CBSSquirrelScene.csb"))
		|| (0 == strcmp(csbFileName, "scene/FNSRabbitScene.csb"))
		|| (0 == strcmp(csbFileName, "scene/THSMacaqueScene.csb"))
		|| (0 == strcmp(csbFileName, "scene/HSDeerScene.csb"))
		|| (0 == strcmp(csbFileName, "scene/EMSBlackBearScene.csb"))
		|| (0 == strcmp(csbFileName, "scene/YDSOrioleScene.csb")))
	{
		auto animalLayer = ForestAnimalLayer::create();
		animalLayer->setDisplay(csbFileName);
		this->addChild(animalLayer);
	}
	else if (0 == strcmp(csbFileName, "scene/SapientialTreeScene.csb"))
	{
		auto treeLayer = ForestTreeLayer::create();
		treeLayer->setDisplay(csbFileName);
		this->addChild(treeLayer);
	}
	else if (0 == strcmp(csbFileName, "layer/mushroom/HitMonsterLayer.csb"))
	{
		auto HitMonsterLayer = HitMonsterLayer::create();
		HitMonsterLayer->setDisplay(csbFileName);
		this->addChild(HitMonsterLayer);
	}
	else if (0 == strcmp(csbFileName, "scene/BubbleScene.csb"))
	{
		auto BubbleWaittingLayer = BubbleWaittingLayer::create();
		BubbleWaittingLayer->setDisplay(csbFileName);
		this->addChild(BubbleWaittingLayer);
	}
	else if (0 == strcmp(csbFileName, "layer/bubble/BubbleLayer.csb"))
	{
		auto BubbleLayer = BubbleLayer::create();
		BubbleLayer->setDisplay(csbFileName);
		this->addChild(BubbleLayer);
	}
	else if (0 == strcmp(csbFileName, "layer/award/AwardChooseLayer.csb"))
	{
		auto awardLayer = AwardLayer::create();
		awardLayer->setDisplay(csbFileName);
		this->addChild(awardLayer);
	}*/
	
}
void MainScene::setDisplay(const char* csbFileName, const char* layerType)
{
	//BaseMessage*mess = NULL;
	//list<list<string>*>* lists = NULL;
	//setDisplay(csbFileName, layerType, mess, lists, "22", 0, 0, false);
}

void MainScene::setDisplay(const char* csbFileName, BaseMessage*mess, list<list<string>*>* lists, string cardNumber)
{
	/*BaseLayer* displayLayer = NULL;
	if (0 == strcmp(csbFileName, "layer/home/TLGTreeLayer.csb"))
	{
		auto tlgTreeLayer = TLGTreeLayer::create();
		tlgTreeLayer->setDisplay(csbFileName);
		tlgTreeLayer->savemessage(mess);
		tlgTreeLayer->saveSoundsList(lists);
		displayLayer = tlgTreeLayer;
		this->addChild(tlgTreeLayer);
	}
	else if (0 == strcmp(csbFileName, "layer/forest/wonderland/WonderlandLayer.csb"))
	{
		auto WonderlandLayer = WonderlandLayer::create();
		WonderlandLayer->savemessage(mess);
		WonderlandLayer->saveSoundsList(lists);
		WonderlandLayer->setDisplay(csbFileName);
		WonderlandLayer->cardId = cardNumber;
		displayLayer = WonderlandLayer;
		this->addChild(WonderlandLayer);
	}
	else if (0 == strcmp(csbFileName, "layer/award/AwardChooseLayer.csb"))
	{
		auto awardLayer = AwardLayer::create();
		awardLayer->saveMessage(mess);
		awardLayer->saveSoundsList(lists);
		awardLayer->setDisplay(csbFileName);
		awardLayer->cardId = cardNumber;
		displayLayer = awardLayer;
		this->addChild(awardLayer);
	}*/
	
}

void MainScene::setDisplay(const char* csbFileName, const char* layerType, BaseMessage*mess, list<list<string>*>* lists, string cardNumber, int nextPlaceNum, int placeNum, bool isFind)
{
	/*BaseLayer* displayLayer =NULL;
	if (0 == strcmp(layerType, "MG"))
	{
		auto mushroomLayer = MushroomLayer::create();
		mushroomLayer->setDisplay(csbFileName);
		displayLayer = mushroomLayer;
		this->addChild(mushroomLayer);
	}
	else if (0 == strcmp(layerType, "SL"))
	{
		if (strstr(csbFileName,"CBSSquirrelScene.csb"))
		{
			auto WonderlandLayer = WonderlandLayer::create();
			WonderlandLayer->setDisplay("layer/forest/wonderland/WonderlandLayer.csb");
			displayLayer = WonderlandLayer;
			this->addChild(WonderlandLayer);
		}
		else
		{
			auto animalLayer = ForestAnimalLayer::create();
			animalLayer->setDisplay(csbFileName);
			displayLayer = animalLayer;
			this->addChild(animalLayer);
		}
	}
	else if (0 == strcmp(layerType, "messengerForest"))
	{
		auto animalLayer = MessengerAnimalLayer::create();
		animalLayer->csbFileName = csbFileName;
		animalLayer->savemessage(mess);
		animalLayer->saveSoundsList(lists);
		animalLayer->setDisplay(animalLayer->csbFileName.c_str());
		displayLayer = animalLayer;
		this->addChild(animalLayer);
	}
	else if (0 == strcmp(layerType, "JY"))
	{
		auto treeLayer = ForestTreeLayer::create();
		treeLayer->setDisplay(csbFileName);
		displayLayer = treeLayer;
		this->addChild(treeLayer);
	}
	else if (0 == strcmp(layerType, "messengerHome"))
	{
		auto treeLayer = MessengerTreeLayer::create();
		treeLayer->savemessage(mess);
		treeLayer->saveSoundsList(lists);
		treeLayer->setDisplay(csbFileName);
		displayLayer = treeLayer;
		this->addChild(treeLayer); 
	}
	else if (0 == strcmp(layerType, "goldMiningHome"))
	{
		auto treeLayer = GoldMiningTreeLayer::create();
		treeLayer->savemessage(mess);
		treeLayer->saveSoundsList(lists);
		treeLayer->setDisplay(csbFileName);
		displayLayer = treeLayer;
		this->addChild(treeLayer);
	}
	else if (0 == strcmp(layerType, "goldMiningSquare"))
	{
		auto treeLayer = GoldMiningSquareLayer::create();
		treeLayer->cardNumber = cardNumber;
		treeLayer->savemessage(mess);
		treeLayer->saveSoundsList(lists);
		treeLayer->setDisplay(csbFileName);
		treeLayer->isFindBack = isFind;
		displayLayer = treeLayer;
		this->addChild(treeLayer);
	}
	else if (0 == strcmp(layerType, "goldMiningMountain"))
	{
		auto treeLayer = GoldMiningMountainLayer::create();
		treeLayer->csbFileName = csbFileName;
		treeLayer->savemessage(mess);
		treeLayer->saveSoundsList(lists);
		treeLayer->setDisplay(csbFileName);
		treeLayer->cardNumber = cardNumber;
		displayLayer = treeLayer;
		this->addChild(treeLayer);
	}
	else if (0 == strcmp(layerType, "goldMiningPlace"))
	{
		auto treeLayer = GoldMiningPlaceLayer::create();
		treeLayer->csbFileName = csbFileName;
		treeLayer->savemessage(mess);
		treeLayer->saveSoundsList(lists);
		treeLayer->setDisplay(csbFileName);
		treeLayer->cardNumber = cardNumber;
		displayLayer = treeLayer;
		this->addChild(treeLayer);
	}
	else if(0 == strcmp(layerType, "goldMiningHideFirst"))
	{
		auto treeLayer = GoldMiningHideAndFindFirstLayer::create();
		treeLayer->savemessage(mess);
		treeLayer->saveSoundsList(lists);
		treeLayer->nextPlaceNum = nextPlaceNum;
		treeLayer->placeNum = placeNum;
		treeLayer->isFind = isFind;
		treeLayer->cardNumber = cardNumber;
		treeLayer->setDisplay(csbFileName);
		displayLayer = treeLayer;
		this->addChild(treeLayer);
	}
	else if (0 == strcmp(layerType, "goldMiningHideSecond"))
	{
		auto treeLayer = GoldMiningHideAndFindSecondLayer::create();
		treeLayer->savemessage(mess);
		treeLayer->saveSoundsList(lists);
		treeLayer->nextPlaceNum = nextPlaceNum;
		treeLayer->placeNum = placeNum;
		treeLayer->isFind = isFind;
		treeLayer->cardNumber = cardNumber;
		treeLayer->setDisplay(csbFileName);
		displayLayer = treeLayer;
		this->addChild(treeLayer);
	}
	else if (0 == strcmp(layerType, "PP"))
	{
		auto bubbleWaittingLayer = BubbleWaittingLayer::create();
		bubbleWaittingLayer->setDisplay(csbFileName);
		this->addChild(bubbleWaittingLayer);
	}
	else if (0 == strcmp(layerType, "GB"))
	{
		auto awardLayer = NewForestLayer::create();
		awardLayer->setDisplay(csbFileName);
		this->addChild(awardLayer);
	}
	else if (0 == strcmp(layerType, "MG2"))
	{
		auto awardLayer = NewMushroomLayer::create();
		awardLayer->setDisplay(csbFileName);
		this->addChild(awardLayer);
	}*/
}
